package com.github;

import com.github.bean.ServerUser;
import com.github.common.constant.MyConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class DataFetcher {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public String getIsServerOnline(String account) {
        ServerUser serverUser = (ServerUser)stringRedisTemplate.opsForHash().get(MyConstant.ServerUserAccount, account);
        if (serverUser == null)
            return "false";
        return serverUser.isServerOnline()?"true":"false";
    }
}